package com.shujia.wyh.day23;

import java.io.File;

/*
        删除功能
        public boolean delete()

 */
public class FileDemo3 {
    public static void main(String[] args) {
        //将day23下的b.txt封装成一个File对象
        File file = new File("D:\\IdeaProjects\\bigdata17\\src\\com\\shujia\\wyh\\day23\\b.txt");
        boolean b = file.delete();
        System.out.println(b);

        //需求：我想把day23下的aaaa删除掉
        //注意：要想删除一个文件夹，前提是要保证该文件夹不是空的

        //先删除bbbb下的cccc
        File file2 = new File("D:\\IdeaProjects\\bigdata17\\src\\com\\shujia\\wyh\\day23\\aaaa\\bbbb\\cccc");
        file2.delete();

        //再删除aaaa下的bbbb
        File file3 = new File("D:\\IdeaProjects\\bigdata17\\src\\com\\shujia\\wyh\\day23\\aaaa\\bbbb");
        file3.delete();

        //最后删除aaaa文件夹
        File file1 = new File("D:\\IdeaProjects\\bigdata17\\src\\com\\shujia\\wyh\\day23\\aaaa");
        boolean b1 = file1.delete();
        System.out.println(b1);


    }
}
